﻿<%@ Page Language="C#" AutoEventWireup="True" Inherits="Soveryn.Commerce.Pages.Item"
    MasterPageFile="~/Dummy.master" Codefile="Item.aspx.cs" %>

<asp:Content ID="PageContent" ContentPlaceHolderID="PageContentPlaceHolder" runat="server">
    <script type="text/javascript">

        function setItemImage(image, alt, title) {

            $(function () {
                $("#itemImageContainer *").remove();
                $("#itemImageContainer").html("<img src='" + image + "' class='original' alt='" + alt + "' title='" + title + "'/>");
                $("#itemImageContainer").zoom();
            });

        }

    </script>
    <asp:HiddenField ID="HiddenField1" runat="server" />
    <asp:HiddenField ID="ItemIDHiddenField" runat="server" />
    <asp:Label ID="ItemNotFoundLabel" runat="server" Text="Item not found" Visible="false"></asp:Label>
    <asp:Panel ID="ItemPanel" runat="server" CssClass="item">
        <table>
            <tr>
                <td style="vertical-align: top;">
                    <div id="itemImageContainer" class="imageContainer">
                    </div>
                    <div class="itemImageGallery">
                        <asp:HyperLink ID="MainItemImageHyperLink" runat="server" NavigateUrl="javascript:void(0);"
                            CssClass="imageContainer" Visible="false">
                            <asp:Image ID="MainItemImage" runat="server" />
                        </asp:HyperLink>
                        <asp:Repeater ID="ImageGalleryRepeater" runat="server" OnItemDataBound="ImageGalleryRepeater_ItemDataBound">
                            <ItemTemplate>
                                <asp:HyperLink ID="ItemImageHyperLink" runat="server" NavigateUrl="javascript:void(0);"
                                    CssClass="imageContainer">
                                    <asp:Image ID="ItemImage" runat="server" />
                                </asp:HyperLink>
                            </ItemTemplate>
                        </asp:Repeater>
                    </div>
                </td>
                <td style="vertical-align: top;">
                    <div class="info">
                        <h1>
                            <asp:Literal ID="ItemNameLiteral" runat="server" /></h1>
                        <h3>
                            <asp:Literal ID="ItemSummaryLiteral" runat="server" /></h3>
                        <div class="description">
                            <asp:Literal ID="ItemDescriptionLiteral" runat="server" />
                        </div>
                        <!-- SKU drop down -->
                        <asp:Panel ID="ItemSKUDropDownPanel" runat="server" Visible="false">
                            <table>
                                <tr>
                                    <td></td>
                                    <td>
                                        <asp:DropDownList ID="ItemSKUDropDown" runat="server" ValidationGroup="ItemSKUDropDownVG">
                                            <asp:ListItem Text="Choose one" Value="na" />
                                        </asp:DropDownList>
                                        <asp:RequiredFieldValidator ID="ItemSKUDropDownRequired" runat="server" ControlToValidate="ItemSKUDropDown"
                                            InitialValue="na" ErrorMessage="required" ValidationGroup="ItemSKUDropDownVG" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>Quantity: </td>
                                    <td>
                                        <asp:TextBox ID="ItemSKUDropDownQuantityTextBox" runat="server" Width="50" Text="1" />
                                        <asp:RequiredFieldValidator ID="ItemSKUDropDownQuantityTextBoxRequiredFieldValidator"
                                            runat="server" ValidationGroup="ItemSKUDropDownVG" ControlToValidate="ItemSKUDropDownQuantityTextBox"
                                            InitialValue="0" ErrorMessage="required" />
                                        <asp:RangeValidator Type="Integer" MinimumValue="-9999999" MaximumValue="9999999"
                                            ValidationGroup="ItemSKUDropDownVG" ID="ItemSKUDropDownQuantityTextBoxRangeValidator"
                                            runat="server" ControlToValidate="ItemSKUDropDownQuantityTextBox" ErrorMessage="Invalid"
                                            Display="Dynamic" CssClass="cmsValidator" />
                                    </td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td>
                                        <asp:Button ID="ItemSKUDropDownAddToCartButton" runat="server" Text="Add To Cart"
                                            OnClick="ItemSKUDropDownAddToCartButton_Click" ValidationGroup="ItemSKUDropDownVG" />
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                    </div>
                </td>
            </tr>
        </table>
        <!-- item SKUs -->
        <asp:Panel ID="ItemSKUListPanel" runat="server" Visible="false" CssClass="skus">
            <asp:Repeater ID="ItemSKURepeater" runat="server" OnItemDataBound="ItemSKURepeater_ItemDataBound">
                <ItemTemplate>
                    <div class="sku">
                        <asp:HiddenField ID="ItemSKUIDHiddenField" runat="server" />
                        <table style="width: 100%;">
                            <tr>
                                <td style="vertical-align: top;">
                                    <asp:Image ID="SKUImage" runat="server" Style="width: 50px; margin-right: 10px;"
                                        Visible="false" /></td>
                                <td>
                                    <h3>
                                        <asp:Literal ID="SKUNameLiteral" runat="server" />
                                        <asp:Literal ID="SKUOriginalPriceLiteral" runat="server" /></h3>
                                    <div>
                                        <i>
                                            <asp:Literal ID="SKULiteral" runat="server" /></i>
                                    </div>
                                    <asp:Literal ID="SKUDescriptionLiteral" runat="server" />
                                </td>
                                <td style="text-align: right; vertical-align: top;">
                                    <table style="display: inline-block;">
                                        <tr>
                                            <td>
                                                <asp:Literal ID="SKUUnitPrice_CalcLiteral" runat="server" />
                                            </td>
                                            <td style="text-align: right;">
                                                <asp:TextBox ID="QuantityTextBox" runat="server" Width="50" Text="1" Style="text-align: center;" />
                                                <asp:RequiredFieldValidator ID="QuantityTextBoxRequiredFieldValidator" runat="server"
                                                    ControlToValidate="QuantityTextBox" InitialValue="1" ErrorMessage="required"
                                                    Display="Dynamic" />
                                                <asp:RangeValidator Type="Integer" MinimumValue="-9999999" MaximumValue="9999999"
                                                    ID="QuantityTextBoxRangeValidator" runat="server" ControlToValidate="QuantityTextBox"
                                                    ErrorMessage="Invalid" Display="Dynamic" CssClass="cmsValidator" />
                                            </td>
                                            <td style="text-align: right;">
                                                <asp:UpdatePanel ID="AddToCartUpdatePanel" runat="server" UpdateMode="Conditional">
                                                    <ContentTemplate>
                                                        <table>
                                                            <tr>
                                                                <td>
                                                                    <asp:LinkButton ID="ItemSKUListAddToCartButton" runat="server" Text="Add To Cart"
                                                                        OnClick="ItemSKUListAddToCartButton_Click" CssClass="buttonPositive" />
                                                                </td>
                                                                <td>
                                                                    <asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="AddToCartUpdatePanel"
                                                                        runat="server">
                                                                        <ProgressTemplate>
                                                                            <img src="/Files/Themes/<%= Website.DesignFolder %>/loading.gif" alt="" />
                                                                        </ProgressTemplate>
                                                                    </asp:UpdateProgress>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                        <asp:HiddenField ID="ItemSKUIDHdn" runat="server" />
                                                    </ContentTemplate>
                                                </asp:UpdatePanel>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="100">
                                    <asp:Panel ID="SKUOptionsPanel" runat="server" Visible="false" CssClass="options">
                                        <asp:Label ID="AvailableOptionsLbl" runat="server" Text="Available Options" />
                                        <table>
                                            <asp:Repeater ID="PropertyRepeater" runat="server" OnItemDataBound="PropertyRepeater_ItemDataBound">
                                                <ItemTemplate>
                                                    <tr>
                                                        <td>
                                                            <asp:HiddenField ID="PropertyNameHiddenField" runat="server" />
                                                            <%--<asp:HiddenField ID="PropertyNameIDHiddenField" runat="server" />
                                                                <asp:HiddenField ID="PropertyValueSurchargeHiddenField" runat="server" />--%>
                                                            <asp:DropDownList ID="PropertyValueDropDownList" runat="server" />
                                                            <asp:RequiredFieldValidator ID="PropertyValueDropDownRequired" runat="server" ControlToValidate="PropertyValueDropDownList"
                                                                InitialValue="na" ErrorMessage="required" />
                                                        </td>
                                                    </tr>
                                                </ItemTemplate>
                                            </asp:Repeater>
                                        </table>
                                    </asp:Panel>
                                </td>
                            </tr>
                        </table>
                    </div>
                </ItemTemplate>
            </asp:Repeater>
        </asp:Panel>
    </asp:Panel>
</asp:Content>
